cmake_minimum_required(VERSION 3.0.0)
project(asio_sigcpp VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 17)

include(CTest)
enable_testing()


find_package(PkgConfig REQUIRED)
SET(ENV{PKG_CONFIG_PATH} /usr/local/lib/pkgconfig)
pkg_search_module(SIGCPP REQUIRED sigc++-3.0)
pkg_search_module(ASIO REQUIRED asio)

function(mybuild example_source_file)
    get_filename_component(example_name ${example_source_file} NAME_WE)
    add_executable(${example_name} ${example_source_file})
    target_include_directories(${example_name}
        PRIVATE
        ${SIGCPP_INCLUDE_DIRS}
        ${ASIO_CINDLUE_DIRS}
    )
    target_link_libraries(${example_name}
        PRIVATE
        ${SIGCPP_LIBRARIES}
        ${ASIO_LIBRARIES}
        pthread
    )
endfunction(mybuild)

mybuild(timer.cpp)
mybuild(thread.cpp)


set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
